package com.mentorgen.tools.util.profile.bundle;

import java.util.Iterator;
import java.util.List;
import java.util.Arrays;

final class BundleFilter {
	
//	static List<String> filterList = Arrays.asList("org.example.osgi.reader");
	static List<String> filterExcludeList = Arrays.asList("" +
			"com.notehive.osgi.rubis.hibernate-osgi-rubis");
	
	static List<String> filterIncludeList = Arrays.asList(
//			"com.notehive.osgi.hibernate-samples.hibernate-session",
			"com.notehive.osgi.rubis.hibernate-osgi-rubis*");
	
	public static boolean exclude(String symbolicName){
		Iterator<String> itr = filterExcludeList.iterator(); 
		while (itr.hasNext())
			if (Util.matchWildCard(symbolicName, itr.next()))
				return true;
		return false;
	}
	
	public static boolean include(String symbolicName){
		Iterator<String> itr = filterIncludeList.iterator(); 
		while (itr.hasNext())
			if (Util.matchWildCard(symbolicName, itr.next()))
				return true;
		return false;
	}
	
	public static boolean filterInclude(String symbolicName){
		return (!exclude(symbolicName) && include(symbolicName));
	}
	
	public static boolean filterExclude(String symbolicName){
		return (exclude(symbolicName) && !include(symbolicName));
	}
}
